/*
  cpgf Library
  Copyright (C) 2011, 2012 Wang Qi http://www.kbasm.com/
  All rights reserved.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/


#include "cpgf/gmetafield.h"


namespace cpgf {

namespace meta_internal {


void GMetaFieldDataBase::deleteObject()
{
	this->virtualFunctions->deleteObject(this);
}

bool GMetaFieldDataBase::canGet() const
{
	return this->virtualFunctions->canGet(this);
}

bool GMetaFieldDataBase::canSet() const
{
	return this->virtualFunctions->canSet(this);
}

GVariant GMetaFieldDataBase::get(void * instance) const
{
	return this->virtualFunctions->get(this, instance);
}

void GMetaFieldDataBase::set(void * instance, const GVariant & v) const
{
	this->virtualFunctions->set(this, instance, v);
}

size_t GMetaFieldDataBase::getFieldSize() const
{
	return this->virtualFunctions->getFieldSize(this);
}

void * GMetaFieldDataBase::getFieldAddress(void * instance) const
{
	return this->virtualFunctions->getFieldAddress(this, instance);
}

GMetaConverter * GMetaFieldDataBase::createConverter() const
{
	return this->virtualFunctions->createConverter(this);
}

	
} // namespace meta_internal


bool GMetaField::canGet() const
{
	return this->baseData->canGet();
}

bool GMetaField::canSet() const
{
	return this->baseData->canSet();
}

GVariant GMetaField::get(void * instance) const
{
	if(this->isStatic()) {
		instance = NULL;
	}

	return this->baseData->get(instance);
}

void GMetaField::set(void * instance, const GVariant & v) const
{
	if(this->isStatic()) {
		instance = NULL;
	}

	this->baseData->set(instance, v);
}

void * GMetaField::getAddress(void * instance) const
{
	return this->baseData->getFieldAddress(instance);
}

size_t GMetaField::getSize() const
{
	return this->baseData->getFieldSize();
}

GMetaConverter * GMetaField::createConverter() const
{
	return this->baseData->createConverter();
}


} // namespace cpgf
